print("@property装饰器##################################################start")


# Python内置的@property装饰器就是负责把一个方法变成属性调用的
class Student(object):

    @property
    def score(self):
        return self.__score

    @score.setter
    def score(self, value):
        if not isinstance(value, int):
            raise ValueError('score must be an integer!')
        if value < 0 or value > 100:
            raise ValueError('score must between 0 ~ 100!')
        self.__score = value


s = Student()
s.score = 60 # 实际转化为s.set_score(60)
print(s.score) # 实际转化为s.get_score()
# s.score = 900
print("@property装饰器##################################################end\n")
